<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Theron: Theron::Receiver::Receiver</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Theron
   &#160;<span id="projectnumber">6.00.02</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceTheron.html">Theron</a></li><li class="navelem"><a class="el" href="classTheron_1_1Receiver.html">Receiver</a></li>  </ul>
</div>
</div><!-- top -->
<div class="contents">
<table cellspacing="0" cellpadding="0" border="0">
  <tr>
   <td valign="top">
      <div class="navtab">
        <table>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_aaecc6c19f587eac73103dc16c71a45df.html#aaecc6c19f587eac73103dc16c71a45df">Consume</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_a753087ea4ee8670ae098b4704b4056a4.html#a753087ea4ee8670ae098b4704b4056a4">Count</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_ad10a6893273e6a468c0400d256e4fd38.html#ad10a6893273e6a468c0400d256e4fd38">DeregisterHandler</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_ade22428952084fee67865a194ade6df2.html#ade22428952084fee67865a194ade6df2">GetAddress</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_af52a34e59cded82445938db098ea9e08.html#af52a34e59cded82445938db098ea9e08">Receiver</a></td></tr>
          <tr><td class="navtab"><a class="qindexHL" href="classTheron_1_1Receiver_a1cf977f348a48e9f5c294d70f2c46992.html#a1cf977f348a48e9f5c294d70f2c46992">Receiver</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_a5f40851291b164ac7499550fe935431d.html#a5f40851291b164ac7499550fe935431d">RegisterHandler</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_a4cd17c1a51a4f01e66313c2fa0a0de44.html#a4cd17c1a51a4f01e66313c2fa0a0de44">Reset</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_a5dbee36b18e7c0549ba860d93e2265fd.html#a5dbee36b18e7c0549ba860d93e2265fd">Wait</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="classTheron_1_1Receiver_a0495c119f3048947e43a8330225c8d45.html#a0495c119f3048947e43a8330225c8d45">~Receiver</a></td></tr>
        </table>
      </div>
   </td>
   <td valign="top" class="mempage">
<a class="anchor" id="a1cf977f348a48e9f5c294d70f2c46992"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Theron::Receiver::Receiver </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classTheron_1_1EndPoint.html">EndPoint</a> &amp;&#160;</td>
          <td class="paramname"><em>endPoint</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *const&#160;</td>
          <td class="paramname"><em>name</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Explicit constructor. </p>
<p>Constructs a receiver tied to the given <a class="el" href="classTheron_1_1EndPoint.html">EndPoint</a>, with the given unique name.</p>
<p>The optional name parameter allows constructed receiver objects to be given unique, user-defined names. These names can then be used to send messages to the receiver in situations where the sending code has no direct reference to the destination receiver, so can't query it for its address. This is especially important when sending messages to remote receiver, and requires that the receiver is tied to an <a class="el" href="classTheron_1_1EndPoint.html">EndPoint</a>.</p>
<p>If the name parameter is null then the receiver is given an automatically generated name, which is guaranteed to be globally unique as long as the names of all EndPoints are globally unique. The generated name can still be used to send messages (if the receiver is tied to an <a class="el" href="classTheron_1_1EndPoint.html" title="Network communication object. ">EndPoint</a>), but since it is automatically generated it can't be known in advance and must be queried by calling <a class="el" href="classTheron_1_1Receiver_ade22428952084fee67865a194ade6df2.html#ade22428952084fee67865a194ade6df2">GetAddress</a>.</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>MyActor : <span class="keyword">public</span> <a class="code" href="classTheron_1_1Actor.html">Theron::Actor</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line"></div>
<div class="line">    MyActor(<a class="code" href="classTheron_1_1Framework.html">Theron::Framework</a> &amp;framework, <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keyword">const</span> name) :</div>
<div class="line">      Theron::Actor(framework, name)</div>
<div class="line">    {</div>
<div class="line">        <a class="code" href="classTheron_1_1Receiver_a5f40851291b164ac7499550fe935431d.html#a5f40851291b164ac7499550fe935431d">RegisterHandler</a>(<span class="keyword">this</span>, &amp;MyActor::Handler);</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line"><span class="keyword">private</span>:</div>
<div class="line"></div>
<div class="line">    <span class="keywordtype">void</span> Handler(<span class="keyword">const</span> std::string &amp;message, <span class="keyword">const</span> <a class="code" href="classTheron_1_1Address.html">Theron::Address</a> from)</div>
<div class="line">    {</div>
<div class="line">        Send(std::string(<span class="stringliteral">&quot;world&quot;</span>), <a class="code" href="classTheron_1_1Address.html">Theron::Address</a>(<span class="stringliteral">&quot;receiver&quot;</span>));</div>
<div class="line">    }</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><a class="code" href="structTheron_1_1EndPoint_1_1Parameters.html">Theron::EndPoint::Parameters</a> params(<span class="stringliteral">&quot;local&quot;</span>, <span class="stringliteral">&quot;tcp://192.168.10.104:5555&quot;</span>);</div>
<div class="line"><a class="code" href="classTheron_1_1EndPoint.html">Theron::EndPoint</a> endPoint(params);</div>
<div class="line"><a class="code" href="classTheron_1_1Framework.html">Theron::Framework</a> framework(endPoint);</div>
<div class="line"><a class="code" href="classTheron_1_1Receiver.html">Theron::Receiver</a> receiver(endPoint, <span class="stringliteral">&quot;receiver&quot;</span>);</div>
<div class="line"></div>
<div class="line">MyActor actor(framework, <span class="stringliteral">&quot;actor&quot;</span>);</div>
<div class="line"></div>
<div class="line">framework.<a class="code" href="classTheron_1_1Framework_a2d5f7f6508227d578dfcedf40dc0b9d0.html#a2d5f7f6508227d578dfcedf40dc0b9d0">Send</a>(</div>
<div class="line">    std::string(<span class="stringliteral">&quot;hello&quot;</span>),</div>
<div class="line">    <a class="code" href="classTheron_1_1Address.html">Theron::Address</a>(<span class="stringliteral">&quot;receiver&quot;</span>),</div>
<div class="line">    <a class="code" href="classTheron_1_1Address.html">Theron::Address</a>(<span class="stringliteral">&quot;actor&quot;</span>));</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>The name defined on construction should be globally unique across all connected hosts. The name string parameter is copied, so can be destroyed after the call. </dd></dl>

</div>
</div>
    </td>
  </tr>
</table>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
